﻿#include "WRWorkDeviceStatusChangeEvent.h"

static int g_workDeviceStatusChangeEventType = QEvent::registerEventType();

//判断指定的事件是否是当前事件。
bool WRWorkDeviceStatusChangeEvent::identify(const QEvent* e)
{
    return (e) && (e->type() == g_workDeviceStatusChangeEventType);
}
//判断指定的事件是否是当前事件。
bool WRWorkDeviceStatusChangeEvent::identify(const QEvent& e)
{
    return e.type() == g_workDeviceStatusChangeEventType;
}

//初始化工作设备状态改变事件。
WRWorkDeviceStatusChangeEvent::WRWorkDeviceStatusChangeEvent(WRWorkDevice* target, WRWorkStatus status)
    : QEvent((QEvent::Type)g_workDeviceStatusChangeEventType)
{
    m_index = -1;
    m_target = target;
    m_status = status;
    m_target->addRef();
}
//初始化工作设备状态改变事件。
WRWorkDeviceStatusChangeEvent::WRWorkDeviceStatusChangeEvent(int index, WRWorkDevice* target, WRWorkStatus status)
    : QEvent((QEvent::Type)g_workDeviceStatusChangeEventType)
{
    m_index = index;
    m_target = target;
    m_status = status;
    m_target->addRef();
}
//释放当前对象所占用的相关资源。
WRWorkDeviceStatusChangeEvent::~WRWorkDeviceStatusChangeEvent(void)
{
    m_target->release();
}
